package net.adetech.web.utils;

import net.adetech.utils.spring.IEntity;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by sunfeihu on 2016/10/21.
 */
public class UtilsCurrent {

    public static void put(IEntity entity, HttpServletRequest request) {
        request.setAttribute("jr_" + entity.getClass().getName(), entity);
    }

    public static <T> T current(Class<T> classType, HttpServletRequest request) {
        return (T) request.getAttribute("jr_" + classType.getName());
    }

}